

import 'package:dartx/dartx.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../../../../app_session.dart';

mixin AuthBaseView {
  Widget buildWidget() {
    return Scaffold(
      extendBodyBehindAppBar: true,
      appBar: AppBar(
          backgroundColor: Colors.transparent, title: Text(getTitle())),
      body: Container(
        decoration: const BoxDecoration(
          image: DecorationImage(
            image: AssetImage('assets/images/auth/auth_bg.png'),
            fit: BoxFit.cover,
          ),
        ),
        child: SafeArea(
          child: ListView(
            children: [
              // 品牌区域
              buildBrandSection(),
              // 表单内容
              buildFormContent(),
              // 提交认证
              buildSubmitBtn(),
            ],
          ),
        ),
      ),
    );
  }

  String getTitle() {
    int identity = app.getUser()!.identity.toInt();
    switch (identity) {
      case 0: // 供应商
        return '供应商认证'.tr;
      case 1: // 采购商
        return '采购商认证'.tr;
      case 2:
        return '货代公司认证'.tr;
      case 3:
        return '运输公司认证'.tr;
      case 4:
        return '服务商认证'.tr;
      case 5:
        return '翻译认证'.tr;
      case 6:
        return '个人认证'.tr;
      default:
        return '认证'.tr;
    }
  }

  // 品牌区域
  Widget buildBrandSection() {
    return Stack(
      children: [
        Container(
          padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16),
          child: Row(
            children: [
              Expanded(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    const Text(
                      'GULZ',
                      style: TextStyle(
                        fontSize: 32,
                        fontWeight: FontWeight.bold,
                        color: Colors.black,
                      ),
                    ),
                    const SizedBox(height: 4),
                    Text(
                      '跨越山海 链接未来'.tr,
                      style: TextStyle(fontSize: 14, color: Colors.black),
                    ),
                  ],
                ),
              ),
            ],
          ),
        ),
        Positioned(
          bottom: -30,
          right: 10,
          top: 0,
          child: Image.asset('assets/images/auth/auth_translation_logo.png'),
        ),
      ],
    );
  }

  // 表单内容
  Widget buildFormContent() {
    return Center();
  }

  // 提交按钮
  Widget buildSubmitBtn() {
    return Center();
  }

}